package com.ymx.darling.type;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class CharacterHandler implements TypeHandler<Character>{
    @Override
    public Character getResult(ResultSet resultSet, int columIndex) throws SQLException {
        String result = resultSet.getString(columIndex);
        return result != null ? result.charAt(0) : null;
    }

    @Override
    public void setParameter(PreparedStatement statement, Character value, int index) throws SQLException {
        statement.setString(index, value.toString());
    }
}
